<template>
  <tr>
    <th>
      <input
        type="checkbox"
        :checked="data.checked"
        @input="$emit('change-event', index)"
      />
    </th>
    <th>{{ data.name }}</th>
    <th>{{ data.price }}</th>
    <th>
      <button
        :disabled="data.num === 0"
        @click="$emit('jj', index, data.num - 1)"
      >
        -
      </button>
      {{ data.num }}
      <button @click="$emit('jj', index, data.num + 1)">+</button>
    </th>
    <th>{{ allPrice }}</th>
    <th><button @click="$emit('del-event', index)">删除</button></th>
  </tr>
</template>

<script>
export default {
  name: "ShopCar",
  components: {},
  props: {
    index: {
      type: Number,
    },
    data: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {};
  },
  computed: {
    allPrice() {
      return this.data.num * this.data.price;
    },
  },
  watch: {},
  created() {},
  methods: {},
};
</script>

<style scoped></style>
